package nimble.unionpay.openapi;

import org.apache.commons.lang3.StringUtils;

public enum CardMedia{

    MAGNETIC_STRIPE_CARD("1","磁条"),
    IC_CARD("2","IC卡"),
    FALL_BACK_CARD("3","Fall Back卡"),
    VIRTUAL_CARD("4","虚拟卡"),
    CHARACTER_CARD("5","纯字符卡"),
    BIOLOGY_CARD("6","生物特征卡"),
    NO_CARD("7","无卡");

    private String code;
    private String desc;

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    CardMedia(String code, String desc)
    {
        this.code=code;
        this.desc=desc;
    }

    public static CardMedia parse(String code)
    {
        for(CardMedia cardMedia:CardMedia.values())
        {
            if(StringUtils.equalsAny(code,cardMedia.name(),cardMedia.getCode()))
            {
                return cardMedia;
            }
        }
        return null;
    }

}
